<?php
/**
 *	  商户分组数据层
 *	  by Ouyoung
 *
 */
class supplier_group_table extends table {
    protected $status_arr = array('禁用', '正常');
	protected $_validate = array( 
		array('title', 'require', '{supplier/supplier_group_title_require}', table::MUST_VALIDATE),
        array('title','','{supplier/supplier_group_title_exist}',0,'unique',1),
	);
	protected $_auto = array(
		array('sort ','100'),
        array('status ','1')
	);
    
    public function status($status){
        if(is_null($status)){
            return $this;
        }
        $this->where(array('status'=>$status));
        return $this;
    }
    
	protected function _after_find(&$result, $options) {
		$result['status_text'] = $this->status_arr[$result['type']];
		return $result;
	}
	protected function _after_select(&$result, $options) {
		foreach ($result as &$record) {
			$this->_after_find($record, $options);
		}
		return $result;
	}
	protected function _after_getdetail(&$result, $options){
		return $result;
	}
}